//
// Created by 王乐 on 2022/2/16.
//

#include "LeCubicBoxBehaviour.h"

#include "LeInput.h"
#include "LeScene.h"
#include "LeGameObject.h"

#include "LeCameraManager.h"
#include "LeCameraCADBehaviour.h"

LeCubicBoxBehaviour::LeCubicBoxBehaviour()
{}

LeCubicBoxBehaviour::~LeCubicBoxBehaviour()
{

}

void LeCubicBoxBehaviour::Update()
{
    if(LeInput::getMouseButton(GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS && !m_bIsChanging)
    {
        m_bIsChanging = true;
        if(LeScene::getInstance()->getCurMouseHoverID() == m_pGameObject->ID)
        {
            int id = m_pGameObject->ID;
            LeCameraCADBehaviour* m_pBehaviour = dynamic_cast<LeCameraCADBehaviour*>(LeCameraManager::pCameraObject->m_pBehaviour);
            m_pBehaviour->flipViewType();
        }
    }
    if(LeInput::getMouseButton(GLFW_MOUSE_BUTTON_LEFT) == GLFW_RELEASE)
    {
        m_bIsChanging = false;
    }
}
